package demo1;

public class Test {
    public static void func(Shape shape) {
        shape.draw();//发生动态绑定
    }
    public static void main(String[] args) {
        //Shape shape = new Shape();//err
        Shape shape1 = new Rect();//发生向上转型
        Shape shape2 = new Cycle();
        func(shape1);
        func(shape2);
    }
}
